local shenyingguixu = fk.CreateSkill{
    name = "ym1__shenyingguixu",
    tags = {Skill.Compulsory},
}
Fk:loadTranslationTable{
    ["ym1__shenyingguixu"] = "神影归墟",
    [":ym1__shenyingguixu"] = "锁定技，你使用过的牌进入弃牌堆后，改为【影】洗入牌堆。",
}
shenyingguixu:addEffect(fk.AfterCardsMove, {
    anim_type = "control",
    can_trigger = function (self, event, target, player, data)
        if player:hasSkill(shenyingguixu.name) then
            local ids = {}
            for _, move in ipairs(data) do
                if move.toArea == Card.DiscardPile then
                    for _, info in ipairs(move.moveInfo) do
                        if #player.room.logic:getEventsByRule(GameEvent.UseCard, 1, function (e)
                            local use = e.data
                            if use.from == player and table.contains(Card:getIdList(use.card),info.cardId) then
                                return true
                            end
                        end,nil,Player.HistoryGame) > 0 then
                            table.insert(ids,info.cardId)
                        end
                    end
                end
            end
            if #ids > 0 then
                event:setCostData(self, {cards = ids})
                return true
            end
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local ids = event:getCostData(self).cards
        local moves = {}
        for _, id in ipairs(ids) do
            room:setCardMark(Fk:getCardById(id),shenyingguixu.name,1)
            Fk:filterCard(id)
            if Fk:getCardById(id):getMark(MarkEnum.DestructIntoDiscard) == 0 then
                room:setCardMark(Fk:getCardById(id),MarkEnum.DestructIntoDiscard,1)
                table.insert(moves, {
                    ids = {id},
                    toArea = Card.DrawPile,
                    moveReason = fk.ReasonJustMove,
                    skillName = shenyingguixu.name,
                    drawPilePosition = math.random(#room.draw_pile),
                })
            end
        end
        room:moveCards(table.unpack(moves))
    end,
})
shenyingguixu:addEffect("filter",{
    global = true,
    card_filter = function (self, card, player, isJudgeEvent)
        return card and card:getMark(shenyingguixu.name) ~= 0
    end,
    view_as = function (self, player, card)
        local to = Fk:cloneCard("shade",Card.Spade,1)
        return to
    end,
})
return shenyingguixu